package com.earl.ddBook;

/**
 * Created by 知鹏 on 2018/6/21.
 */

import com.geccocrawler.gecco.annotation.Gecco;
import com.geccocrawler.gecco.annotation.HtmlField;
import com.geccocrawler.gecco.annotation.Request;
import com.geccocrawler.gecco.annotation.Text;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.spider.HtmlBean;

import java.util.List;

@Gecco(matchUrl="http://bang.dangdang.com/books/bestsellers/01.00.00.00.00.00-year-2017-0-1-{page}", pipelines={"consolePipeline", "bookListPipeline"})
public class BookList implements HtmlBean {

    private static final long serialVersionUID=4369792078959596706L;

    @Request
    private HttpRequest request;

    /**
     * 抓取列表项的详细内容，包括titile，价格，详情页地址等
     */
    @HtmlField(cssPath=".bang_list_box > ul > li")
    private List<ProductBrief> details;
    /**
     * 获得商品列表的当前页
     */
    @Text
    @HtmlField(cssPath=" #t__cp ")
    private int currPage;
    /**
     * 获得商品列表的总页数
     */
    @Text
    @HtmlField(cssPath=".paginating > ul > li:nth-child(7)> a")
    private int totalPage;

    public List<ProductBrief> getDetails() {
        return details;
    }

    public void setDetails(List<ProductBrief> details) {
        this.details = details;
    }

    public int getCurrPage() {
        return currPage;
    }

    public void setCurrPage(int currPage) {
        this.currPage = currPage;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public HttpRequest getRequest() {
        return request;
    }

    public void setRequest(HttpRequest request) {
        this.request = request;
    }

}

